package com.emmmya.ocs.modules.system.setting.controller;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @description:
 * @author: 咕噜肉IT小店-黑医
 * @createDate: 2020-11-11
 * @version: 1.0
 */

@Controller
@RequestMapping("/shiro")
public class UserController2 {
    @RequestMapping("/getCurrentUser")
    @ResponseBody
    public String getCurrentUser(){
        Object principal = SecurityUtils.getSubject().getPrincipal();
        if(principal instanceof String){
            return (String)principal;
        }return "不是字符串";
    }
}
